<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Closure;

class CheckLogin
{
    public function handle($request,Closure $next)
    {
        $http_referer = $_SERVER['HTTP_REFERER']; //获取上一次访问的地址
        $member = $request->session()->get('member','');
        if ($member == '') {
            return redirect('/login?return_url='.urlencode($http_referer));
        }

        return $next($request);
    }
}
